#include <bits/stdc++.h>
using namespace std;

int geshu(int x)
{
	int ans=1;
	while(x!=0)
	{
		ans=ans*(x%10);
		x=x/10;
	}
	return ans;
}

int solve(int x)
{
	int result=0;
	while(x>=10)
	{
		x=geshu(x);
		result++;
	}
	return result;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	int a,b;
	cin >> a >> b;
	map <int,int> mp;
	int maxx=0;
	for(int i=a;i<=b;i++)
	{
		int c=solve(i);
		mp[i]=c;
		maxx=max(maxx,c);
	}
	cout << maxx << endl;
	int count1=0;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
	{
		if(it->second==maxx)
		{
			count1++;
		}
	}
	int count2=0;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
	{
		if(it->second==maxx&&count2<=count1-2)
		{
			cout << it->first << " ";
			count2++;
		}
		else if(it->second==maxx&&count2==count1-1)
		{
			cout << it->first;
		}
	}
	return 0;
}
